<template>
  <div class="box">
    <div class="top">手机号登录</div>
    <div class="Return" @click="Return"></div>
    <div class="content">

      <div class="phone">
        <input type="text" placeholder="手机号"  autocomplete="off" v-model="userInfo.phone">
      </div>

      <div class="password">
        <input type="password"  placeholder="密码" autocomplete="off" v-model="userInfo.password">
      </div>
      <div class="login" @click="login">登录</div>

      <div class="use">
              <span>
                <a href="#">重设密码</a>
              </span>
      </div>
    </div>

  </div>

</template>

<script>
  export default {
    name:'phone_login',
    data(){
      return{
        userInfo:{
          phone:'',
          password:'',
        }
      }
    },
    mounted(){

    },
    methods: {
      Return(){
        this.$router.push({ name: 'login' });
      },
      login(){
        this.$http.get(`/api/login/cellphone?phone=${this.userInfo.phone}&password=${this.userInfo.password}`)
          .then((res) => {
            this.$storage.set('user', res.data);
            console.log(this.$storage.get('user'));
            this.$router.push({ path: '/' });
          })
          .catch((err) => {
            console.log(err);
          })
      }
    },

  }

</script>

<style scoped>
  .box{
    width: 100vw;
    height: 100vh;
  }
  .top{
    width: 100vw;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 18px;
    color: #fffdef;
    background: #C64B3D url("../assets/login-register/cancel.png") no-repeat 20px 12px;
    background-size: 14px;
    position: relative;
  }
  .content{
    width: 100vw;
    height: 400px;
    margin-top: 20px;
  }
  .phone,.password{
    width: 90vw;
    height: 40px;
    margin: 0 auto;
    border-bottom: 2px solid #F2F3F4;
  }
  .phone{
    background: url("../assets/login-register/phone.png") no-repeat 5px 10px;
    background-size: 14px;
  }
  .password{
    background: url("../assets/login-register/lock.png") no-repeat 5px 10px;
    background-size: 14px;
  }
  .phone input,.password input{
    width: 80vw;
    height: 30px;
    display: block;
    outline:medium;
    font-size: 16px;
    border: none;
    margin-top: 5px;
    padding-top: 5px;
    margin-left: 35px;

  }
  .password{
    width: 90vw;
    height: 40px;
    margin: 0 auto;
  }
  .login{
    width: 90vw;
    height: 40px;
    border-radius: 45px;
    margin: 30px auto ;
    line-height: 40px;
    text-align: center;
    background: -webkit-linear-gradient(left, #E75D4C ,#C3473A);
    font-size: 18px;
    color: #e79482;
  }
  .use{
    width: 80%;
    height: 40px;
    margin: -10px auto;
    font-size: 15px;
    text-align: center;
    line-height: 40px;
  }
  .use span{
    width: 62px;
    height: 32px;
    font-size: 15px;
    border-bottom: 2px solid #a7a6a6;
    text-align: center;
    line-height: 40px;
    display: inline-block;
  }
  a{
    color: #7d7c7c;
  }
  .Return{
    width: 25px;
    height: 30px;
    position: absolute;
    top: 10px;
    left: 18px;

  }
</style>
